<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <style>
        .box {
            width: 200px;
            height: 200px;
            background-color: grey;
            margin: 50px;

        }
    </style>
</head>

<body>
    <div class="box"></div>
</body>
<script>

    // 鼠标相关的事件
    // onclick    当鼠标左键单击时触发 (按下并松开)
    // ondblclick 当鼠标左键双击时触发 (按下并松开 -> 短时间内)

    // onmousedown  当鼠标按键被按下时触发
    // onmouseup    当鼠标按键被松开时触发
    // onmousemove    当鼠标移动时触发
    // onmousewheel    当鼠标滚轮滚动时触发

    var box = document.querySelector(".box");

    // box.onclick = function () {
    //     console.log("box被单击");
    // }

    // box.ondblclick = function () {
    //     console.log("box被双击");
    // }

    // box.onmousedown = function (e) { // e 形参(e evt event)=> 事件对象(存储着事件触发时相关的信息)
    //     // console.log(e);
    //     console.log("鼠标按下", e.button);  // 0:左  1:中  2:右
    // }

    // box.onmouseup = function (e) {
    //     console.log("鼠标松开", e.button);
    // }

    // box.onmousemove = function (e) {
    //     console.log("鼠标移动", e.x, e.y);
    // }

    // box.onmousewheel = function () {
    //     console.log("鼠标滑轮滚动");
    // }

    box.onmouseover = function () {
        console.log("鼠标滑过");
    }
    box.onmouseout = function () {
        console.log("鼠标滑除");
    }






</script>

</html>